# Maintainer: Patrick von Reth <vonreth@kde.org>

_realname=snoregrowl
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
provides=("${MINGW_PACKAGE_PREFIX}-SnoreGrowl")
replaces=("${MINGW_PACKAGE_PREFIX}-SnoreGrowl")
pkgver=0.5.0
pkgrel=2
pkgdesc="A C and C++ library providing an api to use Growl notifications, based on the GNTP protocol (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=("BSD")
url="https://github.com/Snorenotify/Snorenotify"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-ninja")
options=(!strip staticlibs !buildflags)
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/Snorenotify/${_realname}/archive/v${pkgver}.tar.gz")
sha256sums=('5180628ce1c732abfc1001db48302b0d63534a3d62dc50a4655e0b4675a918be')

build() {
  [[ -d "${srcdir}"/build-${MSYSTEM} ]] && rm -rf "${srcdir}"/build-${MSYSTEM}
  mkdir -p "${srcdir}"/build-${MSYSTEM} && cd "${srcdir}"/build-${MSYSTEM}

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -G"Ninja" \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_BUILD_TYPE=Release \
    ../${_realname}-${pkgver}

  cmake --build .
}

package() {
  cd ${srcdir}/build-${MSYSTEM}
  DESTDIR=${pkgdir} cmake --install .
}
